- /* simshift.cpp by K.Tsuru */
- // function ID = 410 BRADIX
- /**********************************************
- SInteger class
- It provides a bit shift i.e. multiplies by 2^p.
- Both cases p>0 and p<0 are allowed.
- example : 2^1000
- SLong L;
- SInteger d(1);
- d.BitShift(1000L);
- L = d.ConvToDec();
- ***********************************************/
- #ifndef SN_H
- #include "sn.h"
- #endif
- SInteger& SInteger::BitShift(long p){
- if(!p || !Sign(413)) return *this;
- long n = p/(long)BRADIX_BITS, r = p-(long)BRADIX_BITS*n;
- if(r < 0){
- r += BRADIX_BITS; n--;
- }
- ulong mul = 1uL << (int)r;
-
- if(r) IsMult(*this, mul, *this);
- //When n < 0 and it becomes zero, "SetZero()" is executed in the function "ShiftArray()".
- ShiftArray((int)n);
- return *this;
- }
simshift.cpp : last modifiled at 2015/12/14 16:11:09(767 bytes)
created at 2016/04/25 14:53:17
The creation time of this html file is 2017/10/25 11:09:45 (Wed Oct 25 11:09:45 2017).